/**
 * 向下滑翻页
 * @param  {[type]} urlPageList 连接地址
 * @param  {[type]} $container  显示的容器
 * @param  {[type]} loadendDo   加载完成后，回调方法格式：function($data) $data为加载后生成$对象
 * @param  {[type]} nowtime   提交的nowtime参数值，
 * @return {[type]}             [BBL,app]
 */
function doPage(urlPageList,$container,loadendDo,nowtime){
			$window=$(window);
			var _time=nowtime||0;
			//设置$body的高度和宽度
			$body=$("body");
			$body.height($window.height());
			var BBL=BOBOLIB_fun().init($,this,$window,$body);
			var app=new MainApp(BBL);
			var currentPage=0;
			$container.show();
			$container_empty=$('#'+$container.attr('id')+'_empty');
			$container_empty.hide();
			function showAppWait(){ //节点后面加一个加载的动画条
				var $wait=app.popupWait(3,2,$container);
				$wait.css('display','block');
			    $wait.css('width','10px');
			    $wait.css('margin','25px auto');
			}
			//翻页
			var currentPage=0;
			function loadList(page){
				if(currentPage==page) return;
				isLoadList=true;
				showAppWait();
				currentPage=page;
				url=urlPageList;
				$.ajax({
					url:url,
					data:{page_no:page,nowtime:_time},
					success: function(data){
						app.close();
						isLoadList=false;
						var toData={};
						try{
							toData=$.parseJSON(data);
						}catch(e){
							
						}
						if(toData.error){
							if(toData.end){
								isPageEnd=true;
								return;
							}
							if(toData.msg!='') app.alert('提示',toData.msg);
							return;
						}
						//console.log(data);
						var $data=$(data);
						$data.find('.progress-bar').each(function(){
							var $this=$(this);
							var width=parseInt($this.attr('data-to'))+"%";
							$this.css('width',width);
						});
						$container.append($data);
						if(loadendDo) loadendDo($data);
					},
					error:function(){
						app.close();
						//app.alert('提示','网络超时,请重试！');
						isLoadList=false;
					}
				});
			}
			loadList(1);
			var isLoadList=true;
			var isPageEnd=false;
			//滚动条是否滚到底部
			window.onscroll=function(){
				//变量t就是滚动条滚动时，到顶部的距离
				var windowScrollEndy=document.documentElement.scrollHeight||document.body.scrollHeight;
				windowScrollEndy-=30;
				var viewHeight=document.documentElement.clientHeight||document.body.clientHeight;
				var t =document.documentElement.scrollTop||document.body.scrollTop;
				t+=viewHeight;
				if( t >=windowScrollEndy) {
					if(isPageEnd) app.close();
					if(isLoadList||isPageEnd){
						return;
					}
					loadList(currentPage+1);
				}
			}
			return [BBL,app];
		}